import Vue from 'vue'
import Vuex from 'vuex'
import { getlink } from "@/api/getapi.js"
Vue.use(Vuex)
import { flower } from './module/flower.js'
import { cakem } from './module/cakem.js'
export default new Vuex.Store({
    state: {
        hi: "~",
        text: [],
        num: 0,
        nmb: 0
    },
    mutations: {
        add(state, payload) {
            state.hi = payload + state.hi
        },
        fun(state, payload) {
            state.text = payload
        },
        adds(state) {
            state.num += 5
            state.nmb++
        },
    },
    actions: {
        uplink(context) {
            getlink("/tui/data").then((ok) => {
                console.log(ok)
                context.commit("fun", ok.data.tuijian)
            })

        },
    },
    modules: {
        flower,
        cakem
    }
})